#!/bin/bash

############################
#指定生成的文件名
l_fat_name=fat.img
#手机型号信息
l_project_info="VIVO E5"
#项目名
l_platform=MT6577
l_project_name=PD1218

l_project_dir=~/workspace/gphone/${l_platform}/${l_project_name}
#产品名
l_product_name=bbk77_cu_jb
#工作副本目录
l_workcopy=${l_project_dir}/ALPS.JB.MP.V1_W_20120919_trunk_user

#指定fat分区大小，单位是MB
l_size_tmp=`grep "BOARD_FATIMAGE_PARTITION_SIZE" $l_workcopy/mediatek/config/${l_product_name}/configs/EMMC_partition_size.mk | awk -F ":=" '{print $2}' | awk -F "M" '{print $1}'` 
l_size=`echo  "$l_size_tmp / 1 - 10" | bc` 
echo "fat分区大小为$l_size"

#TF卡数据文件绝对路径
l_tf_data=${l_project_dir}/TF_Data/${l_project_name}_[D,d]ata*.rar
############################

file_name=functions.sh
funcs=`which $file_name`
if [ "$funcs" != "" ] ;then
  echo "funcs=$funcs"
  . $funcs
else
  funcs=`dirname $0`/$file_name
  echo "$PWD"
  echo "funcs=$funcs"
  if [ "$funcs" != "" ] ;then
    . $funcs
  else
    exit
  fi
fi

test -f ${l_project_dir}/TF_Data/fat.img && rm -fv ${l_project_dir}/TF_Data/fat.img
echo "mkfatimg.sh "$l_project_info" $l_fat_name  $l_size  $l_tf_data  ${l_workcopy}"
mkfatimg.sh "$l_project_info" $l_fat_name  $l_size  $l_tf_data  ${l_project_dir}/TF_Data

